%pylab inline
import matplotlib.pyplot as plt
from fractions import Fraction # convert e.g. 0.25 ---> '1/4'
# Az abra kimentesehez az alabbiakat a plt.show() ele kell tenni!!!
#savefig('fig_rainbow_p2_1ray.pdf'); # Abra kimentese
#savefig('fig_rainbow_p2_1ray.eps'); # Abra kimentese
# Abra es fontmeretek
xfig_meret= 9 # 12 nagy abrahoz
yfig_meret= 6 # 12 nagy abrahoz
xyticks_meret= 15 # 20 nagy abrahoz
xylabel_meret= 20 # 30 nagy abrahoz
legend_meret= 17 # 30 nagy abrahoz
def Brillouin(J,x):
tmp=(2*J+1)/(2*J)/tanh(x*(2*J+1)/(2*J))-1/(2*J)/tanh(x/(2*J))
return tmp
Brillouin(1/2,1),tanh(1);
Jenő Sólyom: Fundamentals of the Physics of Solids, Volume 1: Structure and Dynamics (A modern szilárdtestfizika alpajai I. A szilárd testek szerkezete és dinamikája)
See: page 475. Eqs. (14.4.10)-(14.4.14) for the magnetization and Fig. 14.10.
There is trick to plot the function $M(T)$ without solving numerically Eq. (14.4.14) (as suggested generally in books). Using Eqs. (14.4.10)-(14.4.14) and with a little algebra we find that the magnetization $M$ and the temperature $T$ can be parametrized by the variable $x$ as
$\frac{M}{M_0} = B_S(x)$, and $\frac{T}{T_c} = \frac{3S}{S+1} \frac{B_S(x)}{x}$,
where $x >0$ is given by Eq. (14.4.13) and $B_S(x) = \frac{2S+1}{2S}\, \coth \frac{2S+1}{2S} x - \frac{1}{2S}\, \coth \frac{1}{2S} x$ is the Brillouin function.
Thus the function M(T) can be plotted as a parametric plot (with parameter $x$).
Svec=[1/2,1,3/2,2,5/2,100]
npoints=10000
pici=0.00001
nagy=500
figsize(xfig_meret,yfig_meret)
x=linspace(pici,nagy,npoints)
[plot(Brillouin(Svec[i],x)/x*3*Svec[i]/(Svec[i]+1),Brillouin(Svec[i],x),label=r'$S= $' + \
str(Fraction(Svec[i]))) for i in range(len(Svec))];
legend(loc='lower left',fontsize=legend_meret)
#legend(loc='best')
#legend()
title("Mean-field calc. of M(T) for ferromagnet with B=0",fontsize=15)
xticks(fontsize=xyticks_meret)
yticks(fontsize=xyticks_meret)
ylabel(r'$\frac{M}{M_0}$',fontsize=xylabel_meret, rotation=0, labelpad=20)
xlabel(r'$T/T_c$',fontsize=xylabel_meret)
xlim(0,1.05)
ylim(0,1.05)
grid();
#savefig('Fig_M_T_mean-field.pdf'); # Abra kimentese
Svec=[3/2]
Bfieldvec = [0.01,0.05,0.1]
npoints=50000
pici=0.00001
nagy=500
figsize(xfig_meret,yfig_meret)
x=linspace(pici,nagy,npoints)
[plot(Brillouin(Svec[i],x)/x*3*Svec[i]/(Svec[i]+1),Brillouin(Svec[i],x),label=r'$S= $' + \
str(Fraction(Svec[i]))+' and B =0') for i in range(len(Svec))];
for Bfield in Bfieldvec:
[plot(Brillouin(Svec[i],x+Bfield)/(x)*3*Svec[i]/(Svec[i]+1),Brillouin(Svec[i],x+Bfield),\
label=r'$B= $' + str(Bfield)) for i in range(len(Svec))];
legend(loc='lower left',fontsize=legend_meret)
#legend(loc='best')
#legend()
title("Mean-field calc. of M(T) for ferromagnet at finite B",fontsize=15)
xticks(fontsize=xyticks_meret)
yticks(fontsize=xyticks_meret)
ylabel(r'$\frac{M}{M_0}$',fontsize=xylabel_meret, rotation=0, labelpad=20)
xlabel(r'$T/T_c$',fontsize=xylabel_meret)
xlim(0,1.7)
ylim(0,1.05)
grid();
#savefig('Fig_M_T_mean-field.pdf'); # Abra kimentese
Svec=[3/2]
npoints=10000
pici=0.00001
nagy=500
figsize(xfig_meret,yfig_meret)
x=linspace(pici,nagy,npoints)
[plot(Brillouin(Svec[i],x)/x*3*Svec[i]/(Svec[i]+1),Brillouin(Svec[i],x),\
label=r'Mean-field for $S= $' + \
str(Fraction(Svec[i])),color='r') for i in range(len(Svec))];
#labelnev=$M(T)/M_0 \approx 1-1/S e^{-\frac{3}{S+1}\frac{T_c}{T}$
xx=linspace(pici,0.4,npoints)
[plot(xx,1-1/Svec[i]*exp(-3/(Svec[i]+1)/xx),\
label=r'Mean-field approx.: $M(T)/M_0 \approx 1-\frac{1}{S} e^{-\frac{3}{S+1}\frac{T_c}{T}}$',color='b')\
for i in range(len(Svec))]
[plot(xx,1-0.117/2/Svec[i]*(xx*(Svec[i]+1)/3)**(3/2),\
label=r'Bloch law: $M(T)/M_0 \approx 1-\frac{0.117}{2S}\,{\left(\frac{S+1}{3}\frac{T}{T_c}\right)}^{3/2}$',\
color='g') for i in range(len(Svec))]
legend(loc='lower left',fontsize=17)
#legend(loc='best')
#legend()
title("M(T) for ferromagnet with B=0",fontsize=15)
xticks(fontsize=xyticks_meret)
yticks(fontsize=xyticks_meret)
ylabel(r'$\frac{M}{M_0}$',fontsize=xylabel_meret, rotation=0, labelpad=20)
xlabel(r'$T/T_c$',fontsize=xylabel_meret)
xlim(0,0.4)
ylim(0.95,1.005)
grid();
#savefig('Fig_M_T_mean-field.pdf'); # Abra kimentese